<?php $this->load->view('common/head');?>
<?php $this->load->view('common/navbar');?>
<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">专营店基本信息</div>

  <!-- Table -->
  <table class="table table-condensed">
    <tbody>
      <tr>
        <td class="bg-primary col-md-1">所属区：</td>
        <td><?php echo $storeData['region'] ?></td>
      </tr>
      <tr>
        <td class="bg-primary col-md-1">专营店：</td>
        <td><?php echo $storeData['storeName'] ?></td>
      </tr>
      <tr>
        <td class="bg-primary col-md-1">年度额度：</td>
        <td><?php echo $procData['yearMoney'] ?></td>
      </tr>
    </tbody>
  </table>
</div>
<table class="table table-condensed table-bordered mb27">
    <thead class="text-center">
        <tr>
          <td class="bg-primary text-center" width="20%">类型</td>
          <td class="bg-primary text-center" width="20%">专营店名称</td>
          <td class="bg-primary text-center" width="30%">年度额度</td>
          <td class="bg-primary text-center" width="30%">申报金额</td>
        </tr>
      </thead>
    <tbody class="text-center" id="inputStoreList">
    <?php
    $yearTotalMoney = $applyTotalMoney = 0;
    ?>
    <?php foreach ($storeList as $k => $v): ?>
      <tr>
        <td><?=$v['storeId']==$procData['storeId'] ? '申报店' :'协办店'?></td>
        <td><?=$v['storeName']?></td>
        <td><?=$v['yearMoney']?></td>
        <td><?=$v['applyMoney']?></td>
      </tr>
      <?php
      $yearTotalMoney += $v['yearMoney'];
      $applyTotalMoney += $v['applyMoney'];
      ?>
    <?php endforeach ?>
    </tbody>
    <tbody class="text-center">
      <tr>
        <td colspan="2">总计:</td>
        <td><span class="yearTotalMoney"><?=$yearTotalMoney?></span></td>
        <td><span class="applyTotalMoney"><?=$applyTotalMoney?></span></td>
      </tr>
    </tbody>
  </table>

<table class="table table-condensed table-bordered mb27">
  <tbody>
    <tr>
      <td class="bg-primary col-md-3">双月申报审核</td>
    </tr>
  </tbody>
</table>

<table class="table table-condensed table-bordered mb27">
  <tbody>
    <tr>
      <td class="bg-primary col-md-3"><?=$itemData['timeUnitStr']?></td>
    </tr>
  </tbody>
</table>
<form class="form-inline" name="audit" id="audit" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
<input type="hidden" name="procId" id="procId" value="<?=$itemData['procId']?>">
<input type="hidden" name="subtype" id="subtype" value="0">
<table class="table table-condensed table-bordered mb27">
  <thead class="text-center">
      <tr>
        <td class="bg-primary text-center">投放编号</td>
        <td class="bg-primary text-center">投放类型</td>
        <td class="bg-primary text-center">投放规格</td>
        <td class="bg-primary text-center">地址</td>
        <td class="bg-primary text-center">合同时间</td>
        <td class="bg-primary text-center">合同金额</td>
        <td class="bg-primary text-center">自证照片</td>
        <td class="bg-primary text-center">审核结果</td>
        <td class="bg-primary text-center">审核意见</td>
      </tr>
    </thead>
  <tbody class="text-center">
  <?php foreach ($itemList as $k => $v): ?>
    <?php
    $v['projectData'] = isset($projectList[$v['projectId']]) ? $projectList[$v['projectId']] : array();
    ?>
    <tr>
      <td><?=$v['projectData']['id']?></td>
      <td><?=$v['projectData']['mediaTypeStr']?></td>
      <td><?=$v['projectData']['mediaSize']?></td>
      <td><?=$v['projectData']['address']?></td>
      <td><?=$v['projectData']['contractStart']?>--<?=$v['projectData']['contractEnd']?></td>
      <td><?=$v['projectData']['applyMoney']?></td>
      <td>
        <?php if ($v['voucher']): ?>
        <a type="button" onclick="showJsonPhotos('<?=printUrl('SpreadSettle','storeItemPhotos', array('itemId'=>$v['id']))?>')" class="btn btn-default" aria-label="Left Align" role="button">
                查看
              </a>
        <?php endif ?>
      </td>
      <td>
        <?php if ($v['auditRs'] == 0 || ($v['auditRs'] > 0 && $this->user['userRole'] >= $v['auditRole'])): ?>
          <?php
            $options = $this->config->item('spredItemAuditOptions');
            $extra = ' class="form-control"  style="width:80px;" ';
            echo form_dropdown('audit['.$v['id'].'][auditRs]', $options, $v['auditRs'], $extra);
          ?>
        <?php endif ?>
      </td>
      <td>
      <textarea style="width: 100px; height: 100px;" class="form-control" rows="3" name="audit[<?=$v['id']?>][auditRemark]" placeholder="审核意见"><?=$v['auditRemark']?></textarea>
      
      </td>
    </tr>
  <?php endforeach ?>
  </tbody>
</table>
<div class="text-center">
<button class="btn btn-default btn-danger" type="button" onclick="$('#subtype').val(0);ajaxFormSubmit('audit')">提交</button>
<button class="btn btn-default btn-danger" style="width:200px;" type="button" onclick="$('#subtype').val(1);ajaxFormSubmit('audit')">提交并审核下一家专营店</button>
<button class="btn btn-default btn-primary" type="button" onclick="window.location.href='<?=$breadcrumb[count($breadcrumb)-2]['url']?>'">返回</button>
</div>
</form>
<?php $this->load->view('common/auditList', $this->viewData); ?>
<?php $this->load->view('common/foot');?>